home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 10
/
AACD 10.iso
/
AACD
/
Programming
/
AmigaTalk
/
System
/
GamePort.st
< prev
next >
Wrap
Text File
|
2000-02-16
|
3KB
|
112 lines
" ---------------------------------------------------------------------"
" GamePort Class allows the user of AmigaTalk to utilize the "
"GamePort Device that the Amiga PC uses to detect input events, such as"
"mouse movement or button clicks or joystick movement. "
""
" WARNING: You should know what you're doing to the Amiga OS before "
" messing with this Class, or any other System Class! "
" ---------------------------------------------------------------------"
Class GamePort :Device
! pname !
[
openGamePort: whichUnit named: portname
<primitive 223 1 portname whichUnit>.
pname <- portname.
^ self
|
closeGamePort
<primitive 223 0 pname>
|
clearGamePortBuffer
<primitive 223 6 pname>
|
getControllerType
"The integer returned by this method is one of the following: "
" GPCT_ALLOCATED -1"
" GPCT_NOCONTROLLER 0"
" GPCT_MOUSE 1"
" GPCT_RELJOYSTICK 2"
" GPCT_ABSJOYSTICK 3"
^ <primitive 223 7 pname>
|
getButtonCode
^ <primitive 223 10 pname>
|
getQualifiers
^ <primitive 223 11 pname>
|
getXPos
^ <primitive 223 12 pname>
|
getYPos
^ <primitive 223 13 pname>
|
getIEAddress
^ <primitive 223 14 pname>
|
getTimeStamp
^ <primitive 223 15 pname>
|
getTriggerKeys
^ <primitive 223 16 pname>
|
getTriggerTime
^ <primitive 223 17 pname>
|
getTriggerXDelta
^ <primitive 223 18 pname>
|
getTriggerYDelta
^ <primitive 223 19 pname>
|
setKeyTransition: transType
"GPTF_UPKEYS = 2, GPTF_DOWNKEYS = 1 or GPTF_DOWNKEYS + GPTF_UPKEYS:"
(transType >= 1 & transType <= 3)
ifTrue: [ <primitive 223 2 pname transType> ]
ifFalse: [ 'transType parameter out of range (1 to 3 only)!' print ]
|
setTimeTransition: timeOutValue
(timeOutValue < 0)
ifTrue: [ 'timeOutValue out of range (S/B >= 0).' print.
^ nil
].
<primitive 223 3 pname timeOutValue>
|
setXDeltaTransition: xvalue
<primitive 223 4 pname xvalue>
|
setYDeltaTransition: yvalue
<primitive 223 5 pname yvalue>
|
setControllerType: newCType
(newCType >= -1 & newCType <= 3)
ifTrue: [ <primitive 223 8 pname newCType> ]
ifFalse: [ 'newCType parameter out of range (-1 to 3 only)!' print ]
"GPCT_ALLOCATED = -1 Allocated by another user"
"GPCT_NOCONTROLLER = 0 Not being used"
"GPCT_MOUSE = 1"
"GPCT_RELJOYSTICK = 2"
"GPCT_ABSJOYSTICK = 3"
|
waitForButton: kvalue ! ret !
ret <- self getButtonCode.
[ret = kvalue] whileFalse: [ret <- self getButtonCode]
|
waitForQualifier: qvalue ! ret !
ret <- self getQualifiers.
[ret = qvalue] whileFalse: [ret <- self getQualifiers]
|
waitForXPos: xvalue ! ret !
ret <- self getXPos.
[ret = xvalue] whileFalse: [ret <- self getXPos]
|
waitForYPos: yvalue ! ret !
ret <- self getYPos.
[ret = yvalue] whileFalse: [ret <- self getYPos]
]